package com.sunwayworld.common.struts2;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sunwayworld.common.utils.SplitPage;

public class BaseAction extends ActionSupport implements ServletRequestAware,
		ServletResponseAware {

	/**
	 * 
	 */
	public static final long serialVersionUID = 1L;

	protected String method;

	protected SplitPage spage = new SplitPage();

	protected HttpServletRequest request;

	protected HttpServletResponse response;

	@SuppressWarnings("unchecked")
	protected Map<String,String> getRenderParameters() {
		return ActionContext.getContext().getParameters();
	}

	public void setServletRequest(HttpServletRequest request) {
		this.request = request;

	}

	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}

	public HttpSession getHttpSession(HttpServletRequest request) {
		return request.getSession();
	}

	public String getMethod() {
		return ActionContext.getContext().getActionInvocation().getProxy()
				.getMethod();
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public SplitPage getSpage() {
		return spage;
	}

	public void setSpage(SplitPage spage) {
		this.spage = spage;
	}

}
